--[[
 -- *名称:WifiAndNetPart
 -- *描述:网络wifi节点
 -- *版权:Copyright © 2016-2018 深圳市三只小熊科技有限公司 版权所有
 -- *作者:Administrator
 -- *创建日期:2017-11-02
 -- *修改日期:2017-11-02
 ]]
local CURRENT_MODULE_NAME = ...
local WifiAndNetPart = class("WifiAndNetPart",PokerPartBase) --登录模块
WifiAndNetPart.DEFAULT_PART = {}
WifiAndNetPart.DEFAULT_VIEW = "wifiandnetlayer"

---
 -- [ctor 默认part构造方法]
 -- @DateTime 2017-09-20
 -- @param    owner [description]
 -- @param    data [description]
 -- @return    [description]
 --
function WifiAndNetPart:ctor(owner, data)
    WifiAndNetPart.super.ctor(self, owner, data)
    self._data = data;
    self:initialize()
end


---
 -- [activate 默认激活该part调用方法]
 -- @DateTime 2017-09-20
 -- @param    data [description]
 -- @return    [description]
 --
function WifiAndNetPart:activate(gameId,node)
	WifiAndNetPart.super.activate(self, CURRENT_MODULE_NAME,node)
	self:doView("startUpdate");
end

---
 -- [deactivate 销毁该part调用方法]
 -- @DateTime 2017-09-20
 -- @return   [description]
 --
function WifiAndNetPart:deactivate()
    WifiAndNetPart.super.deactivate(self,CURRENT_MODULE_NAME)
    if self.view == nil then
		return
	else
		self.view:removeSelf()
		self.view =  nil
	end
end


function WifiAndNetPart:checkUpdateInfo()
	local n_time = os.date("%H:%M")
	self:doView("updateTime", n_time);
	local lua_bridge = global:getModuleWithId(ModuleDef.BRIDGE_MOD)
	local battery_status = lua_bridge:getBatteryStatus()
	local net_status = lua_bridge:getNetStatus()
	self:doView("updateBattery", battery_status);
	self:doView("updateWifi", net_status,100);
end

---
 -- [initialize description]
 -- @DateTime 2017-11-02
 -- @return   [description]
 --
function WifiAndNetPart:initialize()
	self.frame_count = 30
end
---
 -- [getPartId 获取该part的partId]
 -- @DateTime 2017-09-20
 -- @return   [description]
 --
function WifiAndNetPart:getPartId()
	-- body
	return "WifiAndNetPart"
end

return WifiAndNetPart 